package com.arunsawad.ilertu.entity;

import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;

import com.arunsawad.ilertu.adapter.EmergenciesAdapter;

public class Emergency {
	private String name; // used for display - support multiple languages
	private String nameEn;
	private String nameTh;
	private String website;
	private String imageFilename;
	private String tel;
	private Bitmap image;
	private EmergenciesAdapter adapter;

	public Emergency() {

	}

	public Emergency(String nameEn, String nameTh, String website,
			String imageFilename, String tel) {
		this.nameEn = nameEn;
		this.nameTh = nameTh;
		this.website = website;
		this.imageFilename = imageFilename;
		this.tel = tel;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getNameEn() {
		return nameEn;
	}

	public void setNameEn(String nameEn) {
		this.nameEn = nameEn;
	}

	public String getNameTh() {
		return nameTh;
	}

	public void setNameTh(String nameTh) {
		this.nameTh = nameTh;
	}

	public String getWebsite() {
		return website;
	}

	public void setWebsite(String website) {
		this.website = website;
	}

	public String getImageFilename() {
		return imageFilename;
	}

	public void setImageFilename(String imageFilename) {
		this.imageFilename = imageFilename;
	}

	public String getTel() {
		return tel;
	}

	public void setTel(String tel) {
		this.tel = tel;
	}

	public Bitmap getImage() {
		return image;
	}

	public void setImage(Bitmap image) {
		this.image = image;
	}

	public EmergenciesAdapter getAdapter() {
		return adapter;
	}

	public void setAdapter(EmergenciesAdapter adapter) {
		this.adapter = adapter;
	}

	public void loadImage(EmergenciesAdapter adapter, Context context,
			String packageName) {
		// hold a reference to the adapter
		this.adapter = adapter;
		if (imageFilename != null && !imageFilename.equals("")) {
			int id = context.getResources().getIdentifier(imageFilename,
					"drawable", packageName);
			image = BitmapFactory.decodeResource(context.getResources(), id);
			adapter.notifyDataSetChanged();
		}
	}
}
